<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/resources/modular/plugin/taglibs.jsp" %>
<!doctype html>
<head content="-我的">
    <%@ include file="/resources/modular/head/inside_head.jsp" %>
</head>
<body class="GC_Menu_7" name="GC_indvidual">

<%@ include file="/resources/modular/plugin/mainMenu.jsp" %>

<div class="page" name="GC_individual_changemobile">

    <%@ include file="/resources/modular/plugin/mainTopMenu.jsp" %>

    <%@ include file="/resources/modular/plugin/individualMeun.jsp" %>

    <div class="page_right">

        <%@ include file="/resources/modular/plugin/SecuritityGetMobileCode.jsp" %>

        <div class="my_accountSafe_settel_dv" id="GC_securitity_next" style="display: none;">
            <span>手机号码：</span>
            <input class="my_accountSafe_settel_next_newtel" type="text" placeholder="请输入新手机号码">
            <p class="my_accountSafe_settel_next_losepoint">手机号码修改失败！</p>
            <div><a class="my_accountSafe_settel_confirmbtn" href="javascript:;">确认</a></div>
        </div>
    </div>
</div>
<%@ include file="/resources/modular/plugin/SecuritityResultPromptBox.jsp" %>
</body>
</html>
<%@ include file="/resources/modular/foot/inside_footer.jsp" %>
<script>

    var clickChangeFlag = false;
    var reg_mobile_number =/^1[34578]\d{9}$/;

    $(".my_accountSafe_settel_confirmbtn").click(function () {
        var mobilenumber =  $(".my_accountSafe_settel_next_newtel").val();
        var mobilecode =  $(".my_accountSafe_codeinput").val();

        if(clickChangeFlag){
            alert("不能重复点击");
            return false;
        }

        if(!reg_mobile_number.test(mobilenumber)){
            alert("手机号格式不正确");
            return false;
        }

        if(typeof(mobilecode) == "undefined" || mobilecode == ""){
            alert("短信验证码不能为空");
            return false;
        }

        $.ajax({
            url: '${basePath}v2/individual/changmobile',
            type: 'POST',
            data: {"mobileCode": mobilecode,"mobileNumber":mobilenumber},
            error: function (response) {
                $errorMsg(response);
            },
            success: function (ret) {
                if(ret.result){
                    clickChangeFlag = true;
                    $(".pointpage_beginpsd").html("修改手机号码成功");
                    $(".pointpage_dv1").show();
                    $(".my_accountSafe_settel_next_losepoint").hide();
                }else{
                    $(".my_accountSafe_settel_next_losepoint").html(ret.info).show();
                }
            }
        });


    });

</script>